var Ajax = {
	objectList : null,
	initXmlHttp : function(){
		var request = null;
		if(window.XMLHttpRequest){
			request = new XMLHttpRequest();
			if(request.overrideMimeType){
				request.overrideMimeType('text/xml');
			}
		} 
		else if(window.ActiveXObject){
			var versions = ['Microsoft.XMLHTTP', 'MSXML.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.7.0', 'Msxml2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP'];
			for(var i=0; i<versions.length; i++){
				try{
					request = new ActiveXObject(versions[i]);
					if(request){
						return request;
					}
				} catch(e) {}
			}
		}
		return request;
	},
	processResult : function(responseType, xmlRequest){
		switch(responseType){
			case "text" : Ajax.setObjectList(xmlRequest.responseText); break;
			case "xml" : Ajax.setObject(xmlRequest.responseXML);Ajax.setObjectList(xmlRequest.responseXML.getElementsByTagName("Result") ); break;
			default : Ajax.setObjectList(null); break;
		}
	},
	get : function(url, responseType, callback){
		var xmlRequest = this.initXmlHttp();
		var self = this;
		var date = new Date();
		url += url.indexOf("?") == -1 ? "?" : "&";
		url += "reqTime=" + date.getTime();
		xmlRequest.open("get", url, true);
		xmlRequest.onreadystatechange = function(){
			if(xmlRequest.readyState == 4){
				switch(xmlRequest.status){
					case 0 : break;
					case 200 : if (typeof(callback) === "function") { callback.call(self, Ajax.processResult(responseType, xmlRequest)); } else { alert(" callback is not a function.");}  break;
					case 304 : break;
					case 400 : break;
					case 404 :  alert("XmlHttpRequest status: [404] \nThe requested URL "+url+" was not found on this server."); break;
					case 409 : break;
					case 503 :  alert("XmlHttpRequest status: [503] Service Unavailable"); break;
					default : alert("XmlHttpRequest status: [" + xmlRequest.status + "] Unknow status."); break;
				}
			}
		}
		xmlRequest.send(null);
	},
	getValue : function(rowIndex, columnIndex){
		if(rowIndex != null && columnIndex != null) return this.getObjectList()[rowIndex].childNodes[columnIndex].firstChild.nodeValue;
		else return this.getObjectList();
	}
	,
	setObjectList : function(objectList) {
		this.objectList = objectList;
	},
	getObjectList : function() {
		return this.objectList;
	},
	setObject : function(object) {
		this.object = object;
	},
	getObject : function() {
		return this.object;
	},
	test : function(){
		alert('test... ...');
	}
};